All Questions
51 questions
2votes
0answers
62views
A machine learning model for predicting bit strings in Java
I have this GitHub repository (BitPredictor.java). Basically, I tried to harness a machine learning model for predicting bit strings. I have implemented it to the best of my understanding and have ...
1vote
1answer
109views
Bit vector in Java supporting O(1) rank() and O(log n) select() - follow-up
(This post is the continuation of Bit vector in Java supporting O(1) rank() and O(log n) select(). It resides here (version 1.0.1).) Basically, I have implemented everything harold suggested, except ...
1vote
1answer
166views
Bit vector in Java supporting O(1) rank() and O(log n) select()
Introduction I have this GitHub repository (version 1.0.0.). It implements a rank(i) operation in \$\Theta(1)\$ time, and ...
0votes
1answer
315views
Integer multiplication without using multiply operator
I wrote a method that multiplies two integers. Is there a faster approach that doesn't use the * operator? The method mult(a, b) ...
1vote
4answers
194views
Counting initial bits of 0 in Java
I want to count the number of bits set to 0 at the beginning of a byte array. So far the code I have is this: ...
1vote
4answers
200views
Permuting BitSet in Java
I have this tool for permuting bits in BitSets: com.stackexchange.codereview.util.BitPermutation.java: ...
0votes
1answer
164views
Transformations on a game board represented as a bitset
I'm using a long as a bitset to represent a game board. If a field is set (X) the corresponding bit is set, if it's empty (...
6votes
2answers
112views
Count all X-shaped bits from 8 integers
I am given 8 positive 32-bit integer numbers. The task is to write program to count all X-bits. X-bits are groups of 9 bits (3 rows x 3 columns) forming the letter "X". task is to count all X-bits ...
4votes
0answers
814views
Java code to convert BigDecimal to/from .NET decimal
Background In many languages we have built-in data types for representing decimal floating point numbers. In .NET that's decimal, and in Java we have ...
4votes
0answers
755views
RGB to YCbCr conversion in Java
I found a Go language code to do RGB to YCbCr conversion from here! I ported it to Java: ...
0votes
2answers
88views
Given an integer number, invert its bits. You cannot use the ~ operator
Here is my code: ...
0votes
1answer
53views
0votes
1answer
107views
Kademlia bucketing
Kademlia is a DHT (distributed hash table) which uses a specific type of routing table, dependent on the Hamming distance between the "addresses" of two peers on the network. I'm attempting to ...
3votes
1answer
1kviews
Finding binary gap in Java
I want to know the performance of my code for following problem description. For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The number 529 has binary ...
2votes
2answers
923views
Space and time efficient Algorithm for generating prime numbers
I have developed an algorithm for generating prime numbers (which turns out to be an optimized version of the Sieve of Eratosthenes) by reducing the space by a factor of 64. ...